package com.qding.park.adapter.report.conf;

import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;

import com.baidu.disconf.client.common.annotations.DisconfFile;
import com.baidu.disconf.client.common.annotations.DisconfFileItem;

@Service
@Scope("singleton")
@DisconfFile(filename = MyDisconfDataGetter.redis_pool_properties)
public class RedisPoolConfig {
	
	/**
	 * 地址
	 */
	private String host;
	
	/**
	 * 端口
	 */
	private int port;
	
	/**
	 * 最大连接数
	 */
	private int maxTotal;
	
	/**
	 * 最大空闲连接数
	 */
	private int maxIdle;
	
	/**
	 * numTestsPerEvictionRun
	 */
	private int numTestsPerEvictionRun;
	
	/**
	 *  释放连接的扫描间隔（毫秒）
	 */
	private int timeBetweenEvictionRunsMillis;
	
	/**
	 * 连接最小空闲时间
	 */
	private int minEvictableIdleTimeMillis;
	
	/**
	 * 连接空闲多久后释放, 当空闲时间>该值 且 空闲连接>最大空闲连接数 时直接释放
	 */
	private int softMinEvictableIdleTimeMillis;
	
	/**
	 * 获取连接时的最大等待毫秒数,小于零:阻塞不确定的时间,默认-1
	 */
	private int maxWaitMillis;
	
	/**
	 * 在获取连接的时候检查有效性, 默认false
	 */
	private boolean testOnBorrow;
	
	/**
	 * 在空闲时检查有效性, 默认false
	 */
	private boolean testWhileIdle;
	
	/**
	 * 连接耗尽时是否阻塞, false报异常,ture阻塞直到超时, 默认true
	 */
	private boolean blockWhenExhausted;
	
	private int database;
	
	@DisconfFileItem(name = "host",associateField ="host")
	public String getHost() {
		return host;
	}

	public void setHost(String host) {
		this.host = host;
	}
	
	@DisconfFileItem(name = "port",associateField ="port")
	public int getPort() {
		return port;
	}

	public void setPort(int port) {
		this.port = port;
	}
	
	@DisconfFileItem(name = "maxTotal",associateField ="maxTotal")
	public int getMaxTotal() {
		return maxTotal;
	}

	public void setMaxTotal(int maxTotal) {
		this.maxTotal = maxTotal;
	}
	
	@DisconfFileItem(name = "maxTotal",associateField ="maxTotal")
	public int getMaxIdle() {
		return maxIdle;
	}

	public void setMaxIdle(int maxIdle) {
		this.maxIdle = maxIdle;
	}
	
	@DisconfFileItem(name = "numTestsPerEvictionRun",associateField ="numTestsPerEvictionRun")
	public int getNumTestsPerEvictionRun() {
		return numTestsPerEvictionRun;
	}

	public void setNumTestsPerEvictionRun(int numTestsPerEvictionRun) {
		this.numTestsPerEvictionRun = numTestsPerEvictionRun;
	}
	
	@DisconfFileItem(name = "timeBetweenEvictionRunsMillis",associateField ="timeBetweenEvictionRunsMillis")
	public int getTimeBetweenEvictionRunsMillis() {
		return timeBetweenEvictionRunsMillis;
	}

	public void setTimeBetweenEvictionRunsMillis(int timeBetweenEvictionRunsMillis) {
		this.timeBetweenEvictionRunsMillis = timeBetweenEvictionRunsMillis;
	}
	
	@DisconfFileItem(name = "minEvictableIdleTimeMillis",associateField ="minEvictableIdleTimeMillis")
	public int getMinEvictableIdleTimeMillis() {
		return minEvictableIdleTimeMillis;
	}

	public void setMinEvictableIdleTimeMillis(int minEvictableIdleTimeMillis) {
		this.minEvictableIdleTimeMillis = minEvictableIdleTimeMillis;
	}
	
	@DisconfFileItem(name = "softMinEvictableIdleTimeMillis",associateField ="softMinEvictableIdleTimeMillis")
	public int getSoftMinEvictableIdleTimeMillis() {
		return softMinEvictableIdleTimeMillis;
	}

	public void setSoftMinEvictableIdleTimeMillis(int softMinEvictableIdleTimeMillis) {
		this.softMinEvictableIdleTimeMillis = softMinEvictableIdleTimeMillis;
	}
	
	@DisconfFileItem(name = "maxWaitMillis",associateField ="maxWaitMillis")
	public int getMaxWaitMillis() {
		return maxWaitMillis;
	}

	public void setMaxWaitMillis(int maxWaitMillis) {
		this.maxWaitMillis = maxWaitMillis;
	}
	
	@DisconfFileItem(name = "testOnBorrow",associateField ="testOnBorrow")
	public boolean isTestOnBorrow() {
		return testOnBorrow;
	}

	public void setTestOnBorrow(boolean testOnBorrow) {
		this.testOnBorrow = testOnBorrow;
	}
	
	@DisconfFileItem(name = "testWhileIdle",associateField ="testWhileIdle")
	public boolean isTestWhileIdle() {
		return testWhileIdle;
	}

	public void setTestWhileIdle(boolean testWhileIdle) {
		this.testWhileIdle = testWhileIdle;
	}
	
	@DisconfFileItem(name = "blockWhenExhausted",associateField ="blockWhenExhausted")
	public boolean isBlockWhenExhausted() {
		return blockWhenExhausted;
	}

	public void setBlockWhenExhausted(boolean blockWhenExhausted) {
		this.blockWhenExhausted = blockWhenExhausted;
	}

	@DisconfFileItem(name = "database",associateField ="database")
    public int getDatabase() {
        return database;
    }

    
    public void setDatabase(int database) {
        this.database = database;
    }
	
	
}
